package wowraidmanager.server.service.wishlist;

import java.util.ArrayList;
import java.util.List;

import org.slim3.datastore.Datastore;

import wowraidmanager.client.service.wishlist.RaidbossDroplistService;
import wowraidmanager.server.meta.wishlist.RaidbossDroplistMeta;
import wowraidmanager.shared.model.wishlist.RaidbossDroplist;

import com.google.appengine.api.datastore.Key;

public class RaidbossDroplistServiceImpl implements RaidbossDroplistService {
    RaidbossDroplistMeta query = RaidbossDroplistMeta.get();

    public void setRaidbossDroplist(RaidbossDroplist raidbossDroplist){
        Datastore.put(raidbossDroplist);
    }

    public void setRaidbossDroplistList(ArrayList<RaidbossDroplist> raidbossDroplistlist){
        Datastore.put(raidbossDroplistlist);
    }

    public ArrayList<RaidbossDroplist> getRaidbossDroplist(){

        return (ArrayList<RaidbossDroplist>)Datastore.query(query).sort(query.gameVersion.desc, query.order.asc).asList();
    }

    public void deleteRaidbossDroplist(String bossName){
        List<Key> deleteListRaidbossDroplist = Datastore.query(query).filter(query.bossName.equal(bossName)).asKeyList();

        Datastore.delete(deleteListRaidbossDroplist);

    }
}
